/*
 *   AS IS License
 * ==Naive Coders==
 */
package org.naive.metawatch.converter.cap;

import java.text.ParseException;
import org.naive.metawatch.converter.parser.FieldSize;
import org.naive.metawatch.converter.parser.ParsedFixedIntArray;
import org.naive.metawatch.converter.parser.cap.CapParseContext;
import org.naive.metawatch.converter.parser.cap.CapParseable;

/**
 *
 * @author gbu.000
 */
public class CapMethodInfo extends CapParseable {
    public CapMethodHeaderInfo header;
    public byte [] bytecodes;
    private final int bytecodeSize;

    public CapMethodInfo(int size) {
        bytecodeSize = size;
    }
    
    @Override
    public void parse(CapParseContext px) throws ParseException {
        header = new CapMethodHeaderInfo();
        header.parse(px);
        bytecodes = (byte[]) ParsedFixedIntArray.FieldParser.parse(px, 
                bytecodeSize, FieldSize.BYTE, byte.class);
    }
}
